<div class="yh_login">
	<div class="m-weixin-header">
            <p><strong>请您及时付款，以便订单尽快处理！订单号：<?php echo $order['UserOrder']['ordernum']?></strong></p>
            <p>请您在提交订单后1小时内支付，否则订单会自动取消。</p>
    </div>
	<div class="m-weixin-main">
		<h1 class="m-weixin-title">微信支付</h1>
		<?php if($state):?>
			<p class="m-weixin-money">
				扫一扫付款<br><br> 
				<strong>￥<?php echo $order['UserOrder']['price_total']?></strong>
			</p>
			<p>
				<img id="code" width="260" height="260" class="m-weixin-code" alt="二维码" 
				src="http://paysdk.weixin.qq.com/example/qrcode.php?data=<?php echo urlencode($msg) ?>"
				>
	        	<?php echo $this->Html->image('Wechat.weixin.0.png',array("class"=>"m-weixin-demo","alt"=>"扫一扫"))?>
	    		<?php echo $this->Html->image('Wechat.weixin.1.png',array("alt"=>"请使用微信扫描二维码以完成支付"))?>
    		</p>
    	<?php else:?>
    		<p class="m-weixin-money">
    		<?php echo $msg?>
    		</p>
    	<?php endif;?>
	</div>
</div>
<?php if($state):?>
<script>
jump = function(){
	$.ajax({
        type: "GET",
        url: 'wechat/WxNativePay/paystate/'+'<?php echo $order['UserOrder']['id']?>/?_'+(new Date()).getTime(),
        dataType: "json",
        success: function(res){
            if(res.state){
                location.reload();
            }else{
            	delayjump();
            }
        },
        error:function(e){
            alert(e);
            delayjump();
        }
	});
};
delayjump = function(){
	setTimeout(jump,3000);
};
$(function(){delayjump();});
</script>
<?php endif;?>
<style>
.yh_login{color:#000;border:none;}
.m-weixin-header {margin-bottom: 10px;}
.m-weixin-header p{padding: 5px;}
.m-weixin-header strong {color: #3C3C3C;}
.m-weixin-main {position: relative;font-size: 18px;text-align: center;width: 998px;padding-bottom: 100px;border: 1px solid #e8e8e8;background-color:#fff;}
.m-weixin-title {text-align: left;font-size: 20px;padding: 20px;margin-bottom: 25px;border-top: 3px solid #0AA733;}
.m-weixin-main p {background-color:#fff;}
.m-weixin-main img {display: block;margin: auto}
.m-weixin-money{text-align:center;}
.m-weixin-money strong {font-size: 28px;font-weight: normal;color: #e32526;}
.m-weixin-code {margin: 30px auto !important;}
.m-weixin-demo {position: absolute;left: 50%;top: 80px;padding-left: 120px;}
</style>